import request from "@/common/Ask";
import type { Role } from "@/interface/Role"
import type {Query} from "@/interface/Query";
import type {Page} from "@/interface/Page";
import type {RoleMenu} from "@/interface/RoleMenu";

export function operatorApi( data : Role ) {
    return request<string>({
        url: 'role/operator',
        method: 'put',
        data: data
    });
}

export function oneIdApi( id : string ) {
    return request<Role>({
        url: 'role/oneId/' + id,
        method: 'get'
    });
}

export function listApi( data : Query ) {
    return request<Page<Role>>({
        url: 'role/list' ,
        method: 'post',
        data: data
    });
}


export function removeApi(data : string[]) {
    return request<any>({
        url: 'role/remove' ,
        method: 'delete',
        data: data
    });
}

export function roleMenuOperatorApi(data : RoleMenu) {
    return request<string>({
        url: 'roleMenu/operator' ,
        method: 'put',
        data: data
    });
}

export function menuIdsApi(data? : string) {
    return request<string[]>({
        url: data ? 'roleMenu/menuIds/' + data : 'roleMenu/menuIds' ,
        method: 'get'
    });
}
